package com.zzw.controller;

import com.zzw.entity.Member;
import com.zzw.entity.Result;
import com.zzw.service.MemberService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Slf4j
@Controller
@RequestMapping("/member/provider")
public class MemberProviderController {
    @Resource
    private MemberService memberService;

    @GetMapping("selectById/{id}")
    @ResponseBody
    public Result selectById(@PathVariable("id") Integer id) {
        log.info("id={}", id);
        Member member = memberService.selectById(id);
        if (member != null) {
            return Result.success("会员查询成功 member-service-provider 10000 =>" + member);
        } else {
            return Result.error("会员查询失败 会员ID " + id + " 不存在");
        }
    }
}
